/* 
 This C File "DB_Ibp_Test.c" 
 Genenated By
 Application <db8action> for Oracle OCI V8
 with the action file "DB_Ibp_Test.act".
 Create: Tue Jun 27 14:40:37 2017
*/

#include <stdio.h>
#include <string.h>
#include "DB_Ibp_Test.h"
static Ibp_Test	R_ibp_test;

static int Ibp_Test_EraseTailSpace(Ibp_Test *_erase_data)
{
	ERASE_TAIL_SPACE(_erase_data->account_no);
	return(0);
}
int DB_ibp_test_read_by_account_no( char *account_no__0,Ibp_Test *_a_data)
{
        int     r;
        DBcurs  _a_curs;

	memset(&R_ibp_test,0,sizeof(Ibp_Test));
        r=dbCursOpen(&_a_curs);
        if (r!=0)
                return(r);
        r=dbCursDefineSelect_va(&_a_curs,
                "SELECT  \n\
			 account_no \n\
			,balance \
		FROM ibp_test \
		WHERE account_no = :account_no__0",
		R_ibp_test.account_no,41,DT_STR,
		&R_ibp_test.balance,8,DT_REA,
		NULL,
		":account_no__0",account_no__0,41,DT_STR,
		NULL);
        if (r!=0)
        {
                goto E;
        };
        r=dbCursExec(&_a_curs);
        if (r!=0)
        {
                goto E;
        };
        r=dbCursFetch(&_a_curs);
        if (r==SQLNOTFOUND) goto E;
        if (r!=0)
        {
                goto E;
        };


	Ibp_Test_EraseTailSpace(&R_ibp_test);
        memcpy(_a_data,&R_ibp_test,sizeof(Ibp_Test));

  E:
        dbCursClose(&_a_curs);
        return(r);
}


int DB_ibp_test_debug_print(char *reason,Ibp_Test *adata, char *filename, int line_no)
{
	IBcomlog_print(filename,line_no,"TABLE [Ibp_Test] REASON[%s] LOG",reason);

	IBcomlog_print(filename,line_no, "account_no: %s", adata->account_no );
	IBcomlog_print(filename,line_no, "balance: %lf", adata->balance );

	return(0);
}
